package com.lantosec.hmrp.core.ureport;

import lombok.extern.log4j.Log4j2;
import org.apache.commons.lang3.RandomStringUtils;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Log4j2
public class TestBeanDataSource {

    public List<Map<String, Object>> loadReportDataForMap(String dsName, String datasetName, Map<String, Object> parameters) {
        log.info(dsName);
        log.info(datasetName);
        log.info(parameters);
        List<Map<String, Object>> list = new ArrayList<>();
        for (int i = 0; i < 200; i++) {
            Map<String, Object> map = new HashMap<>();
            map.put("name", RandomStringUtils.random(10, true, false));
            map.put("idCard", RandomStringUtils.random(18, true, false));
            map.put("sex", i % 3 == 0 ? "男" : "女");
            list.add(map);
        }
        return list;
    }

    public List<TestBean> loadReportDataForBean(String dsName, String datasetName, Map<String, Object> parameters) {
        log.info(dsName);
        log.info(datasetName);
        log.info(parameters);
        List<TestBean> list = new ArrayList<TestBean>();
        for (int i = 0; i < 200; i++) {
            TestBean bean = new TestBean();
            bean.setName(RandomStringUtils.random(10, true, false));
            bean.setIdCard(RandomStringUtils.random(18, true, false));
            bean.setSex(i % 3 == 0 ? "男" : "女");
            list.add(bean);
        }
        return list;
    }
}
